import request from "@/utils/requestForCB";
import store from "@/store/index";
export function isTenant() {
  return !!store.getters.userInfo.tenantId;
}
function videoContext() {
  return isTenant() ? "/video-video" : "/ttvideo";
}
//服务转移
function videoContextTransfer() {
  return isTenant() ? "/video-stdu" : "/ttvideo";
}
//获取视频格式字典表，用于切换
export function getEnumInfo(query) {
  return request({
    url: "/admin/base/system/dict/data/dictType/" + query.enumTypeId,
    method: "get",
  });
}
//查询预置点列表
export function queryPresetList(query) {
  return request({
    url: videoContext() + "/video/query/queryPresetList",
    method: "post",
    data: query,
  });
}
//查询巡航路径
export function queryPatrol(query) {
  return request({
    url: videoContext() + "/video/query/queryPatrol",
    method: "post",
    data: query,
  });
}
//启用/停用巡航路径先获取控制权
export function doPatrol(query) {
  return request({
    url: videoContext() + "/video/control/doPatrol",
    method: "post",
    data: query,
  });
}
//开始/结束云台转动先获取控制权
export function doPtzCmds(query) {
  return request({
    url: videoContext() + "/video/control/doPtzCmds",
    method: "post",
    data: query,
  });
}
//开始/结束聚焦(focus)/缩放(zoom)
export function doCameraFocusOrZoom(query) {
  return request({
    url: videoContext() + "/video/control/doCameraFocusOrZoom",
    method: "post",
    data: query,
  });
}
//转到指定PTZ位置
export function doPtzLocationCmd(query) {
  return request({
    url: videoContext() + "/video/control/doPtzLocationCmd",
    method: "post",
    data: query,
  });
}
//转到预置点
export function doControlPreset(query) {
  return request({
    url: videoContext() + "/video/control/doControlPreset",
    method: "post",
    data: query,
  });
}
//获取通道的录像回放流URL地址
export function getVideoPlaybackUrl(query) {
  return request({
    url: videoContextTransfer() + "/video/player/getVideoPlaybackUrl",
    method: "post",
    data: query,
  });
}
//4.12.获取通道实时流URL地址
export function getVideoRealtimeUrl(query) {
  return request({
    url: videoContextTransfer() + "/video/player/getVideoRealtimeUrl",
    method: "post",
    data: query,
  });
}
//定位
export function thirdLocation(query) {
  return request({
    url: videoContext() + "/video/player/thirdLocation",
    method: "post",
    data: query,
  });
}

//获取用户习惯
export function getUserHabit(query) {
  return request({
    url: videoContext() + "/video/query/getUserHabit",
    method: "post",
    data: query,
  });
}

//设置用户习惯
export function setUserHabit(query) {
  return request({
    url: videoContext() + "/video/query/setUserHabit",
    method: "post",
    data: query,
  });
}

//转动到指定经纬度角度
export function turnToPtzByPointAngle(query) {
  return request({
    url: "/video-video/video/query/turnToPtzByPointAngle",
    method: "post",
    data: query,
  });
}

//指哪打哪
export function focusThisPoint(query) {
  return request({
    url: "/video-video/video/query/focusThisPoint",
    method: "post",
    data: query,
  });
}

//指北针
export function getCompass(query) {
  return request({
    url: "/video-video/video/query/getCompass",
    method: "post",
    data: query,
  });
}
